package com.socialsoftware.ui.Contact;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;

/**
 * Factory for creating a ContactsViewModel with a constructor that takes an Application.
 */
public class ContactsViewModelFactory implements ViewModelProvider.Factory {
    
    private final Application application;
    
    public ContactsViewModelFactory(Application application) {
        this.application = application;
    }
    
    @NonNull
    @Override
    public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
        if (modelClass.isAssignableFrom(ContactsViewModel.class)) {
            return (T) new ContactsViewModel(application);
        }
        throw new IllegalArgumentException("Unknown ViewModel class");
    }
} 